package com.example.anju.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.anju.entity.Result;
import com.example.anju.entity.User;
import com.example.anju.service.UserService;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    //注册
  	@PostMapping("/register")
    public Result register(@RequestBody User user){
        return userService.register(user);
    }
  	
  	//登录
    @PostMapping("/login")
    public Result login(@RequestBody User user){
        return userService.login(user);
    }
    
}

